package com.applet.applet_shangcheng.dao;

import com.applet.applet_shangcheng.entity.Announcement;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;
import com.applet.applet_shangcheng.entity.ShufflingFigure;

import java.util.List;

@Mapper
public interface ShufflingFigureMapper {

    @Select({
            "select goods_id,goods_name,image,create_date,status,connection from tb_shuffling_figure where status=1"
    })
    List<ShufflingFigure>findAll();

    @Select({
            "select goods_id,goods_name,image,create_date,status,connection from tb_shuffling_figure"
    })
    List<ShufflingFigure> findGoods();

    @Insert({
            "insert into tb_shuffling_figure (goods_id,goods_name,image,create_date,status,connection) values (#{goodsId},#{goodsName},#{image},#{createDate},#{status},#{connection})"
    })
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insertGoods(ShufflingFigure shufflingFigure);
    @Delete({
            "delete from tb_shuffling_figure where goods_id=#{goodsId}"
    })
    int deleteGoods(@Param("goodsId") int goodsId);
    @Update({
            "update tb_shuffling_figure set status=#{status} where goods_id=#{goodsId}"
    })
    int updateStatus(@Param("goodsId") int goodsId,@Param("status")int status);

    @Update({
            "update tb_shuffling_figure set goods_name=#{goodsName},image=#{image},create_date=#{createDate},status=#{status},connection=#{connection} where goods_id=#{goodsId}"
    })
    int updateGoods(ShufflingFigure shufflingFigure);

   @Select({
           "select goods_id from tb_shuffling_figure where goods_id=#{goodsId}"
   })
   ShufflingFigure findByGoodsId(int goodsId);

    List<ShufflingFigure> findAll1(String queryString);

    @Select({
            "select goods_id,goods_name,image,create_date,status,connection from tb_shuffling_figure where goods_id=#{goodsId}"
    })
    ShufflingFigure findById(@Param("goodsId")int goodsId);
}
